FROM php:fpm-alpine

RUN set -eux; \
    sed -i 's/dl-cdn.alpinelinux.org/mirrors.aliyun.com/g' /etc/apk/repositories;\
	apk add --no-cache --virtual .build-deps autoconf make g++ libtool pcre-dev tzdata libxml2-dev oniguruma-dev;\
	apk add --no-cache libzip-dev icu-dev libpng-dev;\
	apk add --no-cache --repository http://mirrors.aliyun.com/alpine/edge/community gnu-libiconv;\
    cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime;\
    docker-php-ext-install pdo_mysql mbstring zip opcache intl gd soap;\
    pecl install memcache && docker-php-ext-enable memcache;\
	pecl install redis && docker-php-ext-enable redis;\
	pecl install swoole && docker-php-ext-enable swoole;\
	php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');";\
	php composer-setup.php;\
	php -r "unlink('composer-setup.php');";\
	mv composer.phar /usr/local/bin/composer;\
	chmod 755 /usr/local/bin/composer;\
	composer config -g repo.packagist composer https://mirrors.aliyun.com/composer/;\
	apk del --no-network .build-deps;\
	rm -rf /var/cache/apk/* /tmp/* /var/tmp/* /usr/share/doc/* ~/.pearrc;


ENV LD_PRELOAD /usr/lib/preloadable_libiconv.so php

WORKDIR    /var/www/

EXPOSE 9000
